package cn.jiaqiang.chatgpt.data.types.sdk.code;

import java.util.Random;

/**
 * User: jia-qiang
 * Date: 2024-04-06
 * Time: 3:59
 */
public class RandomCodeUtil {

    public static String generateComplexCode(int length) {
        String characters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
        Random random = new Random();
        StringBuilder code = new StringBuilder();
        for (int i = 0; i < length; i++) {
            code.append(characters.charAt(random.nextInt(characters.length())));
        }
        return code.toString();
    }

}
